<html>
<head>
    <css file="__PUBLIC__/css/body.css"/>
    <css file="__PUBLIC__/css/content.css"/>
    <css file="__STATIC__/icon/icon.css"/>
    <js file="__STATIC__/jquery-1.7.2.min.js"/>
    <css file="__STATIC__/kindeditor/themes/default/default.css" />
    <js file="__STATIC__/kindeditor/kindeditor-min.js"/>
    <js file="__STATIC__/kindeditor/lang/zh_CN.js"/>
    <css file="__STATIC__/uploadify/uploadify.css"/>
    <js file="__STATIC__/uploadify/jquery.uploadify.js"/>
    <js file="__STATIC__/My97DatePicker/WdatePicker.js"/>
    
    <script type="text/javascript">
        $(function(){
                var url1="{:U('Upload/upload_ke_json','',0)}";
                var url2="{:U('Upload/upload_ke_manager','',0)}";
                var editor;
    			KindEditor.ready(function(K) {
    				editor = K.create('.elem1', {
                        uploadJson : url1,
                        fileManagerJson : url2,
                        allowFileManager : true
    				});
    			});
        });  
        function checkboxx(x,_this){
            obj=$('#'+x);
            if($(_this).attr("checked")){
                obj.val(1);
            }else{
                obj.val(0);
            }
        }   
        function men_img(){
            var m_width=$(window).width();
            m_width=(m_width-700)/2;
            //alert(m_width);
            $('.men-img').css('left',m_width);
            $('.men-img').show();
        }
        function close_img(){
            $('.men-img').hide();
        }
        function deleteimg(x){
            var reg=new RegExp(x+'`',"g"); 
            var str=$('#refile_v_v').val();
            str=str.replace(reg,'');
            $('#refile_v_v').val(str);
            $('#refiles_s_s a').each(function(){
                if($(this).attr('href')==x) {
                    $(this).remove();
                }
            });
        }  
        function men_ping(){
            var m_width=$(window).width();
            m_width=(m_width-800)/2;
            //alert(m_width);
            $('.men_ping').css('left',m_width);
            $('.men_ping').show();
        }
        function close_ping(){
            $('.men_ping').hide();
        };               
    </script>
     <style type="text/css">
        .attr input,.attr span{float:left;font-weight: normal;border:0px;background:#f8f8f8;}
        .attr span{height:30px;line-height:30px;}
        
        .dilog{width:600px;height:300px;background:#4679bd;position: fixed;left:0px;top:30px;display:none;}
        .dilog iframe{width:580px;border:0px;height:270px;margin:0px;padding:0px;margin-left:2px;}
        .dilog p{margin:0px;padding:0px;height:20px;line-height:20px;}
        .dilog p a{float:right;margin-right:10px;text-decoration:none;font-size:16px;color:#fff;}
    </style>
</head>
<body>
<form action="{:U('Content/modifyhandle')}" method='post'>
    <div class="top">
        <div class="position"><span class="icon icon-31"></span>当前位置：修改{$module.title}</div>
        <div class="top-title">
            <span class="icon icon-32"></span>
            <div class="top-tool">
                <a class="button-a" href="{:U('Content/index',array('tag'=>$module['tag']))}">返回列表</a>
                <input class="button-b" type="submit" value="提交保存"/>
                <a class="button-a" href="javascript:void(0);" onclick="men_ping()">评论管理</a>
                <input type="hidden" name="tag" value="{$module.tag}"/>
                <input type="hidden" name="id" value="{$body['id']}"/>
            </div>
        </div>
    </div>
    <div class="dilog men_ping" style="width: 750px;">
        <p><a href="javascript:void(0);" onclick="close_ping()">x</a></p>
        <iframe style="width:730px;"  src="{:U('Site/review',array('tag'=>$module['tag'],'pid'=>$body['id']))}"></iframe >
    </div>
    <div class="body">
       <div class="row" style="">
            <div class="col col1">分类：</div>
            <div class="col col2">
                <select name="cid" style="margin-top: 5px;">
                    <foreach name="category" item="v">
                        <option value ="{$v['id']}" <if condition="$v['id'] eq $body['cid']">selected="selected"</if>>{$v['title']}</option>
                    </foreach>
                </select>
            </div>
            <div style="clear: both;"></div>
       </div>
        <div class="row">
                <div class="col col1">访问权限：</div>
                <div class="col col2"> 
                    <select name="access" style="margin-top: 5px;">
                        <option value="0">继承分类</option>
                        <option <if condition="$body['access'] eq 1">selected=""</if> value="1">游客</option>
                        <option <if condition="$body['access'] eq 2">selected=""</if> value="2">会员</option>
                        <option <if condition="$body['access'] eq 3">selected=""</if> value="3">禁止访问</option>
                    </select>
                    <span class="remark">设为"继承分类"将会继承分类的权限</span>
                </div>
                <div style="clear: both;"></div>
        </div>
        <div class="row">
                <div class="col col1">评论权限：</div>
                <div class="col col2">
                    <select name="review" style="margin-top: 5px;">
                        <option value="0">继承分类</option>
                        <option <if condition="$body['review'] eq 1">selected=""</if> value="1">游客</option>
                        <option <if condition="$body['review'] eq 2">selected=""</if> value="2">会员</option>
                        <option <if condition="$body['review'] eq 3">selected=""</if> value="3">禁止评论</option>
                    </select>
                    <span class="remark">设为"继承分类"将会继承分类的权限</span>
                </div>
                <div style="clear: both;"></div>
        </div>
       <foreach name="fields" item="v">
                <if condition="$v.ftype eq 1">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <input type="text" name="{$v.tag}" value="{$body[$v['tag']]}"/>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 2">
                    <div style="font-size: 12px;height:305px;padding:2px 0px;border-bottom:1px solid #dcdcdc;">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2" style="text-align: left;">
                            <textarea style="width: 700px;height:300px;" class="elem1" name="{$v.tag}">{$body[$v['tag']]}</textarea>
                        </div>
                    </div>
                </if>
                <if condition="$v.ftype eq 3">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <input type="text" name="{$v.tag}" value="{$body[$v['tag']]}"/>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 4">
                     <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <script>
                                $(function() {
                                	$("#{$v.tag}_s").uploadify({
                                		height        : 22,
                                		swf           : '__STATIC__/uploadify/uploadify.swf',
                                		uploader      : '{:U("Upload/upload_tp")}',
                                		width         : 60,
                                        multi         :false, //ture多文件，false单文件
                                        queueID:'uploadify_ppt',
                                        buttonText:'',
                                        removeCompleted : true,
                                        'onUploadSuccess':function(file,data,response){
                                                if(data=='error') 
                                                {
                                                    alert('上传出错，请检查原因!(文件大小/文件类型)');
                                                }
                                                else
                                                {
                                                    $('#{$v.tag}').val(data);
                                                }
                                        }
                                	});
                                });
                            </script>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td><input style="margin: 0px;margin-top:2px;" type="text" name="{$v.tag}" id="{$v.tag}" value="{$body[$v['tag']]}"/></td>
                                    <td style="padding-top: 3px;padding-left:3px;"><input type="file" name="{$v.tag}_s" id="{$v.tag}_s"/></td>
                                    <td><div id="uploadify_ppt" style="width: 400px;margin-left:5px;"></div></td>
                                </tr>
                            </table>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 5">
                   
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2">
                            <script>
                            $(function() {
                                
                            	$("#file_upload_1").uploadify({
                            		height        : 22,
                            		swf           : '__STATIC__/uploadify/uploadify.swf',
                            		uploader      : '{:U("Upload/upload_tp")}',
                            		width         : 60,
                                    multi         :true, //ture多文件，false单文件
                                    queueID:'',
                                    buttonText:'',
                                    removeCompleted : true,
                                    queueID:'uploadify_ppts',
                                    'onUploadSuccess':function(file,data,response){
                                            if(data=='error') 
                                            {
                                                    alert('有部分文件上传出错，请检查原因!(文件大小/文件类型)');
                                            }
                                            else
                                            {
                                                $('#refile_v_v').val($('#refile_v_v').val()+data+'`');
                                                $('#refiles_s_s').append("<a target='_blank' href='"+data+"'><img width='30' height='30' style='margin-left:1px;' src='"+data+"'/></a>");
                                            }
                                    }
                            	});
                               
                            });
                            </script>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td style="padding-top:3px;margin-left:3px;">
                                        <input type="file" name="file_upload_1" id="file_upload_1"/>
                                        <input type="hidden" id="refile_v_v" name="refile" value="<foreach name='attachment' item='v'>{$v['url']}`</foreach>"/>
                                        <div id="uploadify_ppts" style="display:none;"></div>
                                    </td>
                                    <td class="title" style="padding:0px 5px;font-size:12px;"><a href="javascript:void(0);" onclick="men_img()">管理</a></td>
                                    <td>
                                        <div style="height: 30px;margin-left:5px;" id="refiles_s_s">
                                            <foreach name="attachment" item="v">
                                                <a target='_blank' href='{$v["url"]}'><img width='30' height='30' style='margin-left:1px;border:0px;' src='{$v["url"]}'/></a>
                                            </foreach>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <div class="dilog men-img">
                                <p><a href="javascript:void(0);" onclick="close_img()">x</a></p>
                                <iframe  src="{:U('Site/attachment',array('tag'=>$module['tag'],'pid'=>$body['id']))}"></iframe >
                            </div>
                        </div>
                    </div>
                </if>
                <if condition="$v.ftype eq 6">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2"> 
                            <input type="text" name="{$v.tag}" readOnly="true"  class="Wdate" onclick="WdatePicker()" value="{$body[$v['tag']]}"/>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 7">
                    <div class="row">
                        <div class="col col1">{$v.title}：</div>
                        <div class="col col2">
                                <input style="float: left;" onclick="checkboxx('{$v.tag}',this)" type='checkbox' <if condition="$body[$v['tag']] eq 1">checked="checked"</if>/>
                                <input type="hidden" id="{$v.tag}" name='{$v.tag}' <if condition="$body[$v['tag']] eq 1"> value="1"</if>/>
                                <span style="float: left;">{$v.title}</span>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
                <if condition="$v.ftype eq 8">
                    <div style="border-bottom:1px solid #dcdcdc;">
                        <div class="col col1" style="font-size: 12px;">{$v.title}：</div>
                        <div>
                                <textarea style="float:left;margin:4px 0px;" name="{$v.tag}">{$body[$v['tag']]}</textarea>
                                <div style="clear: both;"></div>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </if>
            </foreach>
    </div>
    
</form>
</body>
</html>